home *** CD-ROM | disk | FTP | other *** search
- /* frexp.c FUNCTION, FROM P. 215 OF TURBO C BIBLE */
- #include<stdio.h>
- #include<math.h>
- #include<stdlib.h> /* errno is defined here */
- main(int argc, char **argv)
- {
- int exponent;
- double x, mantissa;
-
- if(argc < 2)
- {
- printf("Usage %s <x> \n", argv[0]);
- }
- else
- {
- x = atof(argv[1]);
- mantissa = frexp(x, &exponent);
- printf("%s = %f times 2 raised to %d\n",
- argv[1], mantissa, exponent);
- }
- }